package com.zzyl.nursing.controller.member;

import com.github.pagehelper.Page;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import com.zzyl.serve.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zzyl.common.utils.PageUtils.startPage;

@RequestMapping("/member/orders")
@RestController
public class MemberOrderController extends BaseController {

    @Autowired
    private INursingProjectService projectService;

    /**
     * 分页查询项目列表
     * @param nursingProject
     * @return
     */
    @GetMapping("/project/page")
    public TableDataInfo<NursingProjectVo> pageQuery(NursingProject nursingProject){
        startPage();
        List<NursingProject> list = projectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    /**
     * 根据id查询项目信息
     * @param id
     * @return
     */
    @GetMapping("project/{id}")
    public R<NursingProject> getProjectById(@PathVariable Long id) {

        return R.ok(projectService.selectNursingProjectById(id));
    }
}
